<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">

<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

<title>svn-buildpackage - maintaining Debian packages with Subversion - Importing Debian packages</title>

</head>

<body>

<p><a name="ch-import"></a></p>
<hr>

<p>
[ <a href="ch-start.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch-intro.html">1</a> ]
[ <a href="ch-start.html">2</a> ]
[ 3 ]
[ <a href="ch-tasks.html">4</a> ]
[ <a href="ch-reference.html">5</a> ]
[ <a href="ch-misc.html">6</a> ]
[ <a href="ch-tasks.html">next</a> ]
</p>

<hr>

<h1>
svn-buildpackage - maintaining Debian packages with Subversion
<br>Chapter 3 - Importing Debian packages
</h1>

<hr>

<hr>

<h2><a name="s3.1"></a>3.1 Importing from existing source package files</h2>

<p>
The <samp>svn-inject</samp> utility is intended to import already packaged
source packages into a new subdirectory of the repository, creating the
repository layout as needed.  Normally, it takes two arguments: the .dsc file
of your package and the base URL of the Subversion repository.
</p>

<pre>
     svn-inject translucency_*dsc file:///tmp/z
     cp /tmp/translucency_0.6.0.orig.tar.gz /tmp/tarballs || true
     mkdir -p translucency/branches/upstream
     tar  -z -x -f /tmp/translucency_0.6.0.orig.tar.gz
     mv * current
     svn -q import -m&quot;Installing original source version&quot; translucency file:///tmp/z/translucency
     svn -m Tagging upstream source version copy file:///tmp/z/translucency/branches/
     upstream/current file:///tmp/z/translucency/branches/upstream/0.6.0 -q
     svn -m Forking to Trunk copy file:///tmp/z/translucency/branches/upstream/current file:///tmp/z/translucency/trunk -q
     dpkg-source -x /tmp/translucency_0.6.0-1.dsc
     dpkg-source: extracting translucency in translucency-0.6.0
     svn_load_dirs file:///tmp/z/translucency/trunk . *
     ...
     Running /usr/bin/svn propset svn:executable  initscript
     Running /usr/bin/svn propset svn:executable  debian/rules
     Running /usr/bin/svn propset svn:executable  mounttest.sh
     Running /usr/bin/svn propset svn:executable  mount.translucency
     Running /usr/bin/svn propget svn:eol-style base.h
     Running /usr/bin/svn propget svn:eol-style Makefile
     Running /usr/bin/svn propget svn:eol-style translucency.8
     Running /usr/bin/svn commit -m Load translucency-0.6.0 into translucency/trunk.
     
     Running /usr/bin/svn update
     Cleaning up /tmp/svn_load_dirs_jD7OenzVjI
     Storing trunk copy in /tmp/translucency.
     svn co file:///tmp/z/translucency/trunk /tmp/translucency -q
     svn propset svn:executable 1 debian/rules -q
     svn -m&quot;Fixing debian/rules permissions&quot; commit debian -q
     Done! Removing tempdir.
     Your working directory is /tmp/translucency - have fun!
</pre>

<p>
If you omit the URL, <samp>svn-inject</samp> will try to use the URL of the
current directory as base URL.  I would not rely on this, however.
</p>

<hr>

<h2><a name="s3.2"></a>3.2 On-Build-Time merging</h2>

<p>
A special feature of svn-buildpackage is so called mergeWithUpstream-mode.
Many projects do not want to keep the whole upstream source under revision
control, eg.  because of the large amount of required disc space and process
time.  Sometimes it makes sense to keep only the <samp>debian/</samp> directory
any maybe few other files under revision control.
</p>

<p>
The task of exporting the source from repository and adding it to the upstream
source before building becomes annoying the time.  But the
<samp>svn-buildpackage</samp> tools automate most of this work for you: they
switch to so called mergeWithUpstream-mode if a special flag has been detected:
the mergeWithUpstream (Subversion) property of the <samp>debian</samp>
directory.  <samp>svn-buildpackage</samp> will merge the trunk with upstream
source on build time and <samp>svn-upgrade</samp> will only update the changed
files in this case.
</p>

<p>
To enable this feature during the inital import of the source package, simply
add the <samp>-o</samp> switch to the <samp>svn-inject</samp> call and it will
prepare the source for with mergeWithUpstream-mode: reduce the set of files to
those modified for Debian and set the mergeWithUpstream property.
</p>

<p>
But what, if you decide to switch to mergeWithUpstream-mode after the package
has been injected?  To do this, checkout the whole repository, remove the files
not changed in the Debian package from both upstream source and Debian branch
(<samp>svn rm</samp>) and set the mergeWithUpstream property on
<samp>debian</samp> in the <samp>trunk</samp> directory with <samp>svn propset
mergeWithUpstream 1 debian</samp>.
</p>

<p>
If you actually decide to stop using the mergeWithUpstream-mode, unset the
mergeWithUpstream property as follows: <samp>svn propdel mergeWithUpstream
debian/</samp>.
</p>

<p>
If you don't want to store the upstream sources of all your packages in the
repository, you can pass the <samp>--no-branches</samp> switch to
<samp>svn-inject</samp>, which will prevent <samp>svn-inject</samp> from
creating a <samp>branches</samp> subdirectory.
</p>

<hr>

<p>
[ <a href="ch-start.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch-intro.html">1</a> ]
[ <a href="ch-start.html">2</a> ]
[ 3 ]
[ <a href="ch-tasks.html">4</a> ]
[ <a href="ch-reference.html">5</a> ]
[ <a href="ch-misc.html">6</a> ]
[ <a href="ch-tasks.html">next</a> ]
</p>

<hr>

<p>
svn-buildpackage - maintaining Debian packages with Subversion
</p>

<address>
$LastChangedDate: 2005-09-23 16:17:33 +0200 (Fr, 23 Sep 2005) $<br>
<br>
Eduard Bloch<br>
<br>
</address>
<hr>

</body>

</html>

